#include <iostream>
#include <opencv2/opencv.hpp>
#include <Eigen/Dense>
#include <opencv2/core/eigen.hpp>

int main(){
    cv::Mat image = cv::imread("../Super Mario Bros.jpg", cv::IMREAD_GRAYSCALE);
    if(image.empty()){
        std::cerr<<"Error: Cound not load picture." << std::endl;
        return EXIT_FAILURE;
    }
    cv::imshow("Original Picture:",image);
    Eigen::Matrix3d kernel;
    kernel <<  0, 1, 0, 
              1, -4, 1,
               0, 1, 0;
    // Convert Eigen Matrix to OpenCV Mat
    cv::Mat cvKernel;
    cv::eigen2cv(kernel, cvKernel);
    cvKernel.convertTo(cvKernel, CV_32F);

    // Convolution
    cv::Mat processedImage;
    cv::filter2D(image, processedImage,-1, cvKernel, cv::Point(-1, -1), 0, cv::BORDER_DEFAULT);
    cv::imshow("Processed Picture", processedImage);
    cv::waitKey(0);
    return 0;
}
